#!/bin/sh
echo "---------------------清洗借据信息表的数据--------------------"
hive -v -e "set hive.exec.mode.local.auto=true; \
insert overwrite table xm02dw.receipt_info
select
receipt_id,
loan_appl_id,
cont_id,
loan_id,
cust_id,
regexp_replace(cust_name,'[^一-龥]+','') cust_name,
cust_type,
cer_type,
regexp_replace(cer_number,'[^一-龥|a-z|A-Z]+','') cer_number,
rep_method,
loan_type,
int_rate,
bal,
currency,
rep_num,
arep_num,
orep_num,
arep_time,
rep_time,
frep_time,
odue_status,
odue_days,
pint_rate,
five_level_class,
rep_status,
ins_id,
manager_id,
create_time,
update_time,
remarks,
current_timestamp etl_time
from xm02ods.receipt_info;"
echo $?
echo "-----------借据表已清洗完成--------"
echo "----------------验证数据-------------------------"
c1=`hive -e "set hive.exec.mode.local.auto=true;select count(*) from xm02ods.receipt_info;"`
echo "-----来源表数据量为:${c1}条"
c2=`hive -e "set hive.exec.mode.local.auto=true;select count(*) from xm02dw.receipt_info;"`
echo "-----落地表数据量为:${c2}条"
if [ "$c1" == "$c2" ];then
echo "清洗成功！"
else
echo "清洗失败，请检查脚本"
fi